<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <textarea name="" id="" cols="30" rows="10"></textarea>
    <button>发布</button>
    <ul></ul>
    <!-- <div getTime='20' data-index='2'></div> -->
   <!--  <div class="box">
        <span class="erweima">x</span>
    </div> -->
    <script>
        var btn=document.querySelector('button')
        var text=document.querySelector('textarea')
        var ul=document.querySelector('ul')
        btn.onclick=function(){
        if(text.value==''){
            alert('没有')
            return false
        }else{
            // console.log(text.value);
            var li=document.createElement('li')
            // li.innerHTML=text.value
            // ul.appendChild(li)
            ul.insertBefore(li,ul.children[0])
            li.innerHTML=text.value
           

        }
            /* var li=document.createElement('li')
            ul.appendChild(li) */
        }


















        // var boxs=document.querySelector('.box')
        // console.log('boxs');
       /*  var erw=document.querySelector('.erweima')
        console.log(erw .parentNode); */








        // var div=document.querySelector('div')
        // console.log(div.getAttribute('getTime'));
        // div.setAttribute('data-time',20)
        // console.log(div.getAttribute('data-index'));

        
    </script>
</body>
</html>